home *** CD-ROM | disk | FTP | other *** search
- /*______________________________________________________________________
-
- Help on Wheels
-
- Version 1.1
-
- an AWOL Software Production
- PO Box 24207
- 300 Eagleson Road
- Kanata, Ontario, Canada K2M 2C3
-
- Internet: ab026@freenet.carleton.ca
-
- Copyright © 1994 Ross Brown. All rights reserved.
- Portions written by John Norstad are Copyright © 1988, 1989, 1990
- Northwestern University.
- _____________________________________________________________________*/
-
-
- /*______________________________________________________________________
-
- IMPORTANT: Applications built using the HoWLib library must
- include a copyright notice containing the following text:
-
- Help interface portion Copyright © 1994 Ross Brown.
- _____________________________________________________________________*/
-
-
- /*______________________________________________________________________
-
- HoWLib.h - Help on Wheels Library Interface.
-
- This is the interface which supports clients of the Help on Wheels
- help server. Prospective clients must have the acceptHighLevelEvents
- bit set in their 'SIZE' resource, and must call AEProcessAppleEvent
- from their event loop when they receive an Apple event. The rest,
- as they say, is magic.
-
- It is desirable, but not required, that clients have the canBackground
- bit set in their 'SIZE' resource. A client which does not receive
- events while in the background will not be able to respond to the
- canvassing of all processes which the server does at startup, so its
- name will not appear in the server's Help menu until it is brought
- to the foreground, unless that client started the server. Clients
- supporting Help events do not need to receive events while in the
- background, unless they are background-only, because the server will
- bring the client to the foreground before sending the Help event.
-
- The code segment containing these functions may be relocated or
- purged without concern for safety, except while executing a Help
- event handler. You may want to call UnloadSeg after each call to
- one of these interface functions. If you want the segment to
- remain purgeable at all times, you must also call UnloadSeg after
- calling AEProcessAppleEvent, since the segment implements some
- Apple event handlers which it installs at registration time.
-
- See HoWSample's help file for complete information on the use of
- this interface.
- _____________________________________________________________________*/
-
-
- #ifndef __HOWLIB__
- #define __HOWLIB__
-
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
-
- /* Error codes which clients may receive from this interface: */
-
- /* Client (process) does not exist (severe error). */
- #define noSuchClientErr (-20000)
- /* Client (process) exists, but is not registered with server. */
- #define clientNotRegisteredErr (-20001)
- /* Apple event support is missing from System. */
- #define noAppleEventsErr (-20002)
- /* Process Manager or launch/return support is missing from System. */
- #define noProcessMgrErr (-20003)
- /* Alias Manager support is missing from System. */
- #define noAliasMgrErr (-20004)
- /* FSSpec calls are missing from System. */
- #define noFSSpecCallsErr (-20005)
- /* Client is not high-level-event-aware. */
- #define notHLEAwareErr (-20006)
- /* Help file has no master resource. */
- #define noMasterResErr (-20007)
- /* Help server application not found on any volume. */
- #define noServerApplErr (-20008)
- /* Help file version not as specified. */
- #define wrongVersionErr (-20009)
- /* Notification Manager support is missing from System. */
- #define noNotificationMgrErr (-20010)
- /* Folder Manager support is missing from System. */
- #define noFolderMgrErr (-20011)
- /* Enhanced Standard File support is missing from System. */
- #define noEnhancedStandardFileErr (-20012)
-
-
- /* Operating system creator, file, and resource types: */
-
- /* Creator and type of a detached help file. Help data may be in a */
- /* detached help file, or any file, including the main application file. */
- /* If the help file is detached, it can be opened or printed by itself. */
- #define kHoWHelpCreatorType 'HoW?'
- #define kHoWHelpFileType 'HoW!'
-
- /* Type of the resource which must be present in the help file to point */
- /* to the help data. The server looks for a resource with the following */
- /* IDs, in order: */
- /* 1. the current script's current language code; */
- /* 2. the language code of the server's local version; */
- /* 3. the default language code indicated by the client at registration; */
- /* 4. langEnglish (0). */
- /* See HoWRez.{language}.r for comments about resource requirements. */
- #define kHoWMasterResType 'HoW!'
-
-
- /* Type definitions: */
-
- /* Structure type definition of the master resource. */
- typedef struct HoWMasterResource {
- short firstDocID; /* first doc 'STR#' resource ID */
- short tconID; /* 'TCON' resource ID */
- short tagID; /* 'TAG ' resource ID */
- short cellID; /* 'CELL' resource ID */
- short alertID; /* 'ALRT'/'DITL'/'STR ' resource ID */
- } HoWMasterResource;
-
- /* The Help event handler receives an event id which is the negative */
- /* of the tag associated with the clicked text. */
- typedef pascal void (*HoWHandlerProcPtr) (short id);
-
-
- /* Function prototypes: */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /* Find the help file referenced by the 'alis' resource with ID */
- /* "aliasResID" in the resource file with ID "preferencesFileRefNum", */
- /* or in the resource file with ID "applicationFileRefNum" if the */
- /* resource does not exist in the preferences file or cannot be resolved. */
- /* The alias record, possibly changed by UpdateAlias, is written back to */
- /* the preferences file if possible. The application file is not changed. */
- /* Resolution is relative to the application file, so it can take */
- /* advantage of relative information in the alias resource if present. */
- /* If the help file cannot be found by a fast search, one exhaustive */
- /* search will be done on the alias record in the application file. */
- /* A failed exhaustive search is noted in the preferences file so that it */
- /* is not repeated; this note remains until the preferences file is */
- /* deleted, or until a later fast search successfully finds the help file. */
- /* If you do not maintain a separate preferences file, set both resource */
- /* file IDs to the same value, and the application file will be treated */
- /* as though it were also the preferences file. */
- pascal OSErr HoWFindHelpFile (short preferencesFileRefNum,
- short applicationFileRefNum,
- short aliasResID, FSSpecPtr helpFile);
-
- /* Register or re-register with the help server. The help file may */
- /* be any file, including the main application file. If the help file */
- /* has a 'vers'(1) resource, and the version (first word) does not match */
- /* "version", wrongVersionErr is returned. If there is no master resource */
- /* in the help file for the current script's current language, nor for */
- /* "defaultLanguage", nor for langEnglish, noMasterResErr is returned. */
- /* The server will prefer to use its own language over "defaultLanguage". */
- /* By re-registering, the client can switch to another help file. If the */
- /* server is not already started, and "startServer" is true, HoWRegister */
- /* will try to start the server, which may result in many OS error codes, */
- /* as well as noServerApplErr, a non-fatal code returned for your */
- /* information (see HoWDisplay below). If the server is not already */
- /* started, and "startServer" is false (which it should be for most */
- /* clients), the usual return code is noErr, meaning that the actual */
- /* registration has been deferred until the first non-casual display */
- /* (see below) or until the server starts by some other method. Gestalt */
- /* checks may result in other error codes listed above; the expected */
- /* error code under System 6 is noAppleEventsErr. The Help event */
- /* handler is optional; pass nil if the client does not support them. */
- pascal OSErr HoWRegister (const FSSpec *helpFile, short version,
- LangCode defaultLanguage, Boolean startServer,
- HoWHandlerProcPtr handler);
-
- /* Display the help file at the indicated tag position. If "tag" */
- /* is zero, the last seen position is retained. If the server */
- /* is not already started, and "casual" is false, this will attempt */
- /* to start the server; if the server is absent, the user sees an */
- /* alert offering to save a readable copy using TeachText and open */
- /* it for viewing, unless the client is background-only, in which case */
- /* no alerts appear, and the document is created on the desktop. */
- /* A casual display is effective only if the server is started and */
- /* running in the background, with the "follow" option in effect, */
- /* and already displaying this client's help file. A casual display */
- /* always leaves the client in the foreground; a non-casual display */
- /* always brings the server to the foreground. Note that modal dialogs */
- /* will prevent the server from coming to the foreground unless they */
- /* are hidden before this call. */
- pascal OSErr HoWDisplay (short tag, Boolean casual);
-
- /* Deregister with the help server. If the client fails to deregister */
- /* before it exits, the server will deregister it automatically. */
- pascal OSErr HoWDeregister (void);
-
- /* Launch the help server, if necessary, to open and display the given */
- /* help file. This method is suggested for use by programs which are not */
- /* applications; applications should use HoWRegister instead (see above). */
- /* If the server is absent, a TeachText copy is created on the desktop */
- /* and opened (as for a background-only application calling HoWDisplay). */
- /* Version checking is not performed, and the current script's current */
- /* language is always used. This may be called by 'INIT' logic in control */
- /* panels or extensions, because it uses the Notification Manager; allow */
- /* 5000 bytes when calculating the system heap requirement for your */
- /* 'sysz' resource. */
- pascal OSErr HoWOpen (const FSSpec *helpFile);
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif